

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script type="text/javascript" src="helpman_topicinit.js"></script>

<title>Convert Names [Enterprise Architect User Guide]</title>

<meta name="keywords" content="Enterprise Architect, Sparx Systems, UML, MDA-Style Transformation,MDA-Style Transformation Convert Names,Convert,Convert Names In MDA Transformations,Macro,Macro CONVERT_NAMES,Macro REMOVE_PREFIX,CONVERT_NAMES,REMOVE_PREFIX,Platform Naming Conventions,Transform,Transform Names,Naming Format,Naming Format Camel Case,Naming Format Pascal Case,Naming Format Spaced,Naming Format Underscored,Camel Case,Camel Case Naming Format,Pascal Case,Pascal Case Naming Format">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
  A, A:Visited
  {
    color: #00F;
  }

  A:Active, A:Hover
  {
    color: #F00;
  }

  OL
  {
    margin: 5px 0 5px 48px;
  }

  UL
  {
    margin-bottom: 3px;
    margin-top: 0;
  }

  #nsr
  {
    background-color: #D4DFFF;
  }

  #nsr A
  {
    text-decoration: none;
  }

  #mainbody
  {
    padding: 8px;
  }

  .p_BodyText
  {
    padding: 5px 0;
  }
</style>



<style type="text/css" media="screen">
  BODY
  {
    background-color: #FFFFFF;
  }

  #nsr
  {
    padding: 6px 6px 0 6px;
    border-bottom: none;
    vertical-align: top;
    z-index: 2;
    visibility: visible;
    left: 0;
    top: 0;
    position: absolute;
  }

  #mainbody
  {
    left: 0;
    top: 0;
    margin: 0;
    position: absolute;
    padding: 10px;
    overflow: auto;
    height: 100%;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: bottom right;
    background-attachment: fixed;
  }
</style>

<style type="text/css" media="print">
  #nsr
  {
    visibility: none;
  }

  #mainbody
  {
    overflow: visible;
  }
</style>
<script type="text/javascript" language="JavaScript" src="nonscroll.js"></script>

</head>
<body scroll="no">

<div id="page">



        <div id="content">
          <div id="content-inner">
          



  
          <div id="nsr">
            <table border="0" cellspacing="0" cellpadding="4" width="100%">
              <tr valign="top">
                <td align="left">
  


                  <p class="p_Heading1"><span class="f_Heading1">Convert Names</span></p>



  
                </td>
                <td align="right">
                  <a href="introduction.htm" onmouseover="document.images.main.src='button_main_h.gif'" onmouseout="document.images.main.src='button_main.gif'">
                    <img name="main" src="button_main.gif" border=0 alt="Return to Introduction">
                  </a>&nbsp;
    
                  <a href="convertingtypes.htm" onmouseover="document.images.prev.src='button_prev_h.gif'" onmouseout="document.images.prev.src='button_prev.gif'">
                    <img name=prev src="button_prev.gif" border=0 alt="Previous page" />
                  </a>&nbsp;
    
    
    
                  <a href="crossreferences2.htm" onmouseover="document.images.next.src='button_next_h.gif'" onmouseout="document.images.next.src='button_next.gif'">
                    <img name=next src="button_next.gif" border=0 alt="Next page" />
                  </a>
    
    
                </td>
              </tr>
            </table>
          </div>
          <div id="mainbody">
  


                <p class="p_BodyText"><span class="f_BodyText">Different target platforms use different naming conventions. As a result you might not want to copy the names of your elements directly into the transformed models. To facilitate this requirement, Enterprise Architect's transformation templates provide a </span><span class="f_BodyText" style="font-style: italic;"><a href="convertingnames.htm#CONVERT">CONVERT_NAME</a></span><span class="f_BodyText"> function macro.</span></p>
<p class="p_BodyText"><span class="f_BodyText">Another way in which you can transform a name is to remove a prefix from the original name, with the </span><span class="f_BodyText" style="font-style: italic;"><a href="convertingnames.htm#REMOVE">REMOVE_PREFIX</a></span><span class="f_BodyText"> macro.</span></p>
<p class="p_SubHeadingL1"><a name="convert"></a><span class="f_SubHeadingL1">CONVERT_NAME(&lt;originalName&gt;, &lt;originalFormat&gt;, &lt;targetFormat&gt;)</span></p>
<p class="p_BodyText"><span class="f_BodyText">This macro converts &lt;</span><span class="f_BodyText" style="font-style: italic;">originalName</span><span class="f_BodyText">&gt;, which is assumed to be in &lt;</span><span class="f_BodyText" style="font-style: italic;">originalFormat</span><span class="f_BodyText">&gt;, to &lt;</span><span class="f_BodyText" style="font-style: italic;">targetFormat</span><span class="f_BodyText">&gt;.</span></p>
<p class="p_BodyText"><span class="f_BodyText">The supported formats are:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1">Camel Case: New words start with a capital letter </span><span class="f_Bulletlist1" style="font-style: italic;">except</span><span class="f_Bulletlist1"> for the first word, which begins with a lower case letter; for example, </span><span class="f_Bulletlist1" style="font-style: italic;">myVariableTable</span></li>
<li><span class="f_Bulletlist1">Pascal Case: Same as Camel Case but the first letter of the first word is upper case; for example, </span><span class="f_Bulletlist1" style="font-style: italic;">MyVariableTable</span></li>
<li><span class="f_Bulletlist1">Spaced: Words are separated by spaces; the case of letters is ignored</span></li>
<li><span class="f_Bulletlist1">Underscored: Words are separated by underscores; the case of letters is ignored.</span></li>
</ul>
<div style="text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 5px 0px 5px 13px;"><table cellspacing="0" cellpadding="2" border="0" style="border: none; border-spacing:0px;">
<tr style="text-align:left;vertical-align:bottom;">
<td valign="bottom" width="952" bgcolor="#efeff7" style="width:952px; background-color:#efeff7;"><p class="p_TiporNote" style="border-top: none; border-right: none; border-left: none;"><span class="f_TiporNote">Note:</span></p>
</td>
</tr>
<tr style="text-align:left;">
<td width="952" bgcolor="#f7f7ff" style="width:952px; background-color:#f7f7ff;"><p class="p_TiporNoteText"><span class="f_TiporNoteText">Acronyms are not supported when converting from Camel Case or Pascal Case.</span></p>
</td>
</tr>
</table>
</div>
<p class="p_BodyText"><span class="f_BodyText">The original format might also specify a list of delimiters to be used. For example a value of ' _' breaks words whenever either a space or underscore is found.</span></p>
<p class="p_BodyText"><span class="f_BodyText">The target format might also use a format string that specifies the case for each word and a delimiter between them. It takes the following form:</span></p>
<p class="p_BodyText"><span class="f_BodyText" style="font-style: italic;">&lt;firstWord&gt;(&lt;delimiter&gt;)&lt;otherWords&gt;</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1" style="font-style: italic;">&lt;firstWord&gt;</span><span class="f_Bulletlist1"> controls the case of the first word (see below)</span></li>
<li><span class="f_Bulletlist1" style="font-style: italic;">&lt;delimiter&gt;</span><span class="f_Bulletlist1"> is the string generated between words</span></li>
<li><span class="f_Bulletlist1" style="font-style: italic;">&lt;otherWords&gt;</span><span class="f_Bulletlist1"> applies to all words after the first word.</span></li>
</ul>
<p class="p_BodyText"><span class="f_BodyText" style="font-style: italic;">&lt;firstWord&gt;</span><span class="f_BodyText"> and </span><span class="f_BodyText" style="font-style: italic;">&lt;otherWords&gt;</span><span class="f_BodyText"> are both a sequence of two characters. The first character represents the case of the first letter of that word, and the second character represents the case of all subsequent letters. An upper case letter forces the output to upper case, a lower case letter forces the output to lower case, and any other character preserves the original case.</span></p>
<p class="p_BodyText"><span class="f_BodyText" style="font-weight: bold;">Example 1:</span><span class="f_BodyText"> To capitalize the first letter of each word and separate multiple words with a space:</span></p>
<p class="p_BodyText"><span class="f_BodyText"> </span><span class="f_Code"> &nbsp; &quot;Ht( )Ht&quot; </span><span class="f_BodyText">to output&nbsp;&nbsp;&nbsp; &quot;</span><span class="f_Code">My Variable Table&quot;</span></p>
<p class="p_BodyText"><span class="f_BodyText" style="font-weight: bold;">Example 2:</span><span class="f_BodyText"> To generate the equivalent of Camel Case, but reverse the roles of upper and lower case; that is, all characters are upper case except for the first character of each word </span><span class="f_BodyText" style="font-style: italic;">after</span><span class="f_BodyText"> the first word:</span></p>
<p class="p_BodyText"><span class="f_BodyText"> </span><span class="f_Code"> &nbsp; &quot;HT( )hT&quot; </span><span class="f_BodyText">to output</span><span class="f_Code"> &quot;MY vARIABLE tABLE&quot;</span></p>
<p class="p_SubHeadingL1"><a name="remove"></a><span class="f_SubHeadingL1">REMOVE_PREFIX(&lt;originalName&gt;, &lt;prefixes&gt;)</span></p>
<p class="p_BodyText"><span class="f_BodyText">This macro removes any prefix found in &lt;</span><span class="f_BodyText" style="font-style: italic;">prefixes</span><span class="f_BodyText">&gt; from &lt;</span><span class="f_BodyText" style="font-style: italic;">originalName</span><span class="f_BodyText">&gt;. The prefixes are specified in a semi-colon separated list.</span></p>
<p class="p_BodyText"><span class="f_BodyText">The macro is often used in conjunction with the </span><span class="f_BodyText" style="font-style: italic;">CONVERT_NAME</span><span class="f_BodyText"> macro. For example, this code creates a </span><span class="f_BodyText" style="font-style: italic;">get property name</span><span class="f_BodyText"> according to the options for Java.</span></p>
<p class="p_Code"><span class="f_Code">$propertyName=%REMOVE_PREFIX(attName,genOptPropertyPrefix)%</span></p>
<p class="p_Code"><span class="f_Code">%if genOptGenCapitalisedProperties==&quot;T&quot;%</span></p>
<p class="p_Code"><span class="f_Code">$propertyName=%CONVERT_NAME($propertyName, &quot;camel case&quot;, &quot;pascal case&quot;)%</span></p>
<p class="p_Code"><span class="f_Code">%endIf%</span></p>




            </div>
          </div>
        </div>



</div>


</body>
</html>
